<!DOCTYPE html>
<html>

<head>
    <%- include ../taglib/layout-table.ejs %>


    <script src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>
    <script src="http://cdn.hcharts.cn/highcharts/modules/exporting.js"></script>
    <script src="http://cdn.hcharts.cn/highcharts/themes/gray.js"></script>
    <!--<script src="https://img.hcharts.cn/highcharts-plugins/highcharts-zh_CN.js"></script>-->
    <script type="text/javascript" src="http://cdn.hcharts.cn/highcharts-plugins/highcharts-zh_CN.js"></script>
</head>

<body class="gray-bg sidebar-content">

<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>密码修改
                        <!--<small>包括自定义样式的复选和单选按钮</small>-->
                    </h5>
                    <!--<div class="ibox-tools">-->
                        <!--<a class="collapse-link">-->
                            <!--<i class="fa fa-chevron-up"></i>-->
                        <!--</a>-->
                    <!--</div>-->
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="editForm" method="get">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">原密码</label>
                            <div class="col-sm-10">
                                <input type="password" id="oldPwd"  class="form-control" name="oldPwd">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">新密码</label>

                            <div class="col-sm-10">
                                <input type="password" id="newPwd" class="form-control" name="newPwd">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group ">
                            <div class="col-sm-12 pull-right">
                                <button class="btn btn-primary" type="button" onclick="save()">修改密码</button>
                                <!--<button class="btn btn-white" type="submit">取消</button>-->
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    function save() {
        debugger;
        var newPwd=$('#newPwd').val();
        var oldPwd=$('#oldPwd').val();
        $.ajax({
            type: "get",
            url: "/home/changepass",
            cache: false,
            async: false,
            dataType: "json",
            data:{
                oldPwd:oldPwd,
                newPwd:newPwd
            },
            success: function (data) {
                if(data.success){
                    swal({
                        title: "系统提示",
                        text: data.msg,
                        type: "success"
                    });
                }else {
                    swal({
                        title: "系统提示",
                        text: data.msg,
                        type: "warning"
                    });
                }


            }
        });
    }
</script>
</html>
